<?php

class __registry_controller
{	
    private $arrInstances = array();
	/*
		$oElement : obj call class;
		add_object('__registry_controller');
	*/
    protected function add_object( $object )
    {
		if(is_array($object))
		{
			foreach( $object as $oElement){
				$this->arrInstances[] = new $oElement();
			}
			
		}else{
			$this->arrInstances[] = new $object();
		}
    }    
    	
    public function __call( $strMethod, $arrParams )
    {		
        foreach( $this->arrInstances as $oElement )
        {	
			$arrMethods = get_class_methods( $oElement );
            if( in_array( $strMethod , $arrMethods ) ) 
            {
                $arrCaller = Array( $oElement , $strMethod );
				return call_user_func_array( $arrCaller, $arrParams );
            }
        }
        
    }

}